//
//  UIViewController+NavBar.m
//  YJFinancial
//
//  Created by David Qu on 14-6-3.
//  Copyright (c) 2014年 David Qu Studio. All rights reserved.
//

#import "UIViewController+NavBar.h"
#import "UIColor+SNFoundation.h"
@implementation UIViewController (NavBar)

- (void)updateNavBar
{
    if (IOS_VERSION >= 7) {
        [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
        [[UINavigationBar appearance] setTitleTextAttributes:
         @{NSForegroundColorAttributeName : [UIColor blackColor]}
         ];
//        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:YES];
//        self.navigationController.navigationBar.barTintColor = [UIColor colorFromHexCode:@"f8f8f8"];
        [self.navigationController.navigationBar setBackgroundImage:[[UIColor colorFromHexCode:@"#f8f8f8"] imageWithColor] forBarMetrics:UIBarMetricsDefault];
        [self.navigationController.navigationBar setTranslucent:NO];
        [self.navigationController.navigationBar setTitleTextAttributes:
         @{NSFontAttributeName:[UIFont systemFontOfSize:16],
           NSForegroundColorAttributeName:[UIColor blackColor]}];
    } else {
        [self.navigationController.navigationBar setBackgroundImage:[[UIColor colorFromHexCode:@"#f8f8f8"] imageWithColor] forBarMetrics:UIBarMetricsDefault];
//        [self setWantsFullScreenLayout:YES];
        [[[self navigationController] navigationBar] setNeedsLayout];
        [self.navigationController.navigationBar setTitleTextAttributes:
         @{NSFontAttributeName:[UIFont systemFontOfSize:16],
           NSForegroundColorAttributeName:[UIColor blackColor]}];
    }
}

@end
